<template>
<el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__dept">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
            <el-form-item>
                <el-button v-if="$hasPermission('scenic:newsfood:save')" type="primary" @click="addOrUpdateHandle()">{{ $t("add") }}</el-button>
            </el-form-item>
            <el-form-item>
                <el-button v-if="$hasPermission('scenic:newsfood:delete')" type="danger" @click="deleteHandle()">{{ $t("deleteBatch") }}</el-button>
            </el-form-item>
            <el-form-item>
                <el-button v-if="$hasPermission('scenic:newsfood:import')" type="primary" @click="importHandle()" class="exportRoom">导入</el-button>
            </el-form-item>
            <el-form-item>
                <el-button v-if="$hasPermission('scenic:newsfood:export')" type="primary" @click="exportHandle()">{{ $t("export") }}</el-button>
            </el-form-item>
        </el-form>
        <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle" style="width: 100%">
            <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
            <el-table-column prop="productName" label="商品名称" align="center" :show-overflow-tooltip="true" min-width="150"></el-table-column>
            <!-- <el-table-column prop="businessAddress" label="商品地址" align="center" :show-overflow-tooltip="true" min-width="150"></el-table-column> -->
            <el-table-column prop="individualityMoney" label="集贸市场个体摊位价格" header-align="center" align="center" min-width="150"></el-table-column>
            <el-table-column prop="clzMoney" label="菜篮子工程服务部价格" header-align="center" min-width="150" align="center"></el-table-column>
            <el-table-column prop="dhnzMoney" label="定海南珍菜场价格" min-width="150" header-align="center" align="center"></el-table-column>
            <el-table-column prop="dsgtMoney" label="岱山高亭菜场价格" header-align="center" min-width="150" align="center"></el-table-column>
            <el-table-column prop="ptdhMoney" label="普陀东河菜场价格" header-align="center" min-width="150" align="center"></el-table-column>
            <!-- <el-table-column prop="productInformation" label="商品信息" header-align="center" align="center" :show-overflow-tooltip="true" min-width="150"></el-table-column> -->
            <!-- <el-table-column prop="money" label="商品价格(元)" header-align="center" align="center" min-width="150"></el-table-column> -->
            <el-table-column prop="createDate" label="创建时间" header-align="center" align="center" min-width="160"></el-table-column>
            <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
                <template slot-scope="scope">
                    <el-button v-if="$hasPermission('scenic:newsfood:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t("update") }}</el-button>
                    <el-button v-if="$hasPermission('scenic:newsfood:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t("delete") }}</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle">
        </el-pagination>
        <!-- 导入 -->
        <import v-if="importVisible" ref="import" @refreshDataList="getDataList" :type="0"></import>
        <!-- 弹窗, 新增 / 修改 -->
        <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
</el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
import AddOrUpdate from "./caijiAdd";
import Import from './excel-import'
export default {
    mixins: [mixinViewModule],
    data() {
        return {
            mixinViewModuleOptions: {
                getDataListURL: "/scenic/newsProduct/page",
                deleteURL: "/scenic/newsProduct",
                exportURL: "/scenic/newsProduct/export",
                getDataListIsPage: true,
                deleteIsBatch: true,
            },
            importVisible: false,
            dataForm: {
                type: 0,
            },
        };
    },
    components: {
        AddOrUpdate,
        Import
    },
    methods: {
        //导入
        importHandle: function () {
            this.importVisible = true
            this.$nextTick(() => {
                this.$refs.import.init()
            })
        }
    }
};
</script>
